package com.tjkcht.midware.reader;

import javax.xml.bind.DatatypeConverter;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import rdp_msg.Rdp.rdp_request;


public class Rdp_responseEncoder extends MessageToByteEncoder<rdp_request> {
	@Override
	protected void encode(ChannelHandlerContext ctx, rdp_request msg, ByteBuf out) throws Exception {		
		byte[] msgBytes = msg.toByteArray();	
		
		////			
		ByteBuf outBuf = Unpooled.buffer(msgBytes.length);          
		//2、写入缓冲区内容  
		outBuf.writeBytes(msgBytes);		
		out.writeBytes(msgBytes);
		System.out.println("writeccccc byte[]="+DatatypeConverter.printHexBinary(msgBytes));
	}
}
